import request from '@/utils/request'

// 保存流程详情
export function saveBpmn(data) {
  return request({
    url: '/flowable/bpmn/save',
    method: 'post',
    data: data
  })
}

// 获取流程详情
export function listBpmn(appId) {
  return request({
    url: '/flowable/bpmn/list/' + appId,
    method: 'get'
  })
}

// 挂起或激活流程
export function suspenOrActiv(id) {
  return request({
    url: '/flowable/bpmn/suspenOrActiv/' + id,
    method: 'get'
  })
}

// 获取流程图
export function readXml(deployId) {
  return request({
    url: '/flowable/bpmn/readXml/' + deployId,
    method: 'get'
  })
}

// 获取起始表单
export function startForm(deployId) {
  return request({
    url: '/flowable/bpmn/startForm/' + deployId,
    method: 'get'
  })
}

// 删除部署
export function delBpmn(deployId) {
  return request({
    url: '/flowable/bpmn/' + deployId,
    method: 'delete'
  })
}


// 测试发起流程
export function runtest(deployId, data) {
  return request({
    url: '/flowable/bpmn/runtest/' + deployId,
    method: 'post',
    data: data
  })
}

// 设置为主版本
export function setMain(appId, deployId) {
  return request({
    url: '/flowable/bpmn/setMain/' + appId + '/' + deployId,
    method: 'get'
  })
}